<template>
  <div>
    <el-page-header @back="goBack" content="详情页面"> </el-page-header>
    <div class="demo-image">
      <div class="block" v-for="fit in fits" :key="fit">
        <span class="demonstration">{{ fit }}</span>
        <el-image
          style="width: 300px; height: 300px"
          :src="url"
          :fit="fit"
        ></el-image>
      </div>
      <div class="a">
        <el-input type="textarea" :rows="2" placeholder="" v-model="textarea1">
        </el-input>
      </div>
      <div class="b">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入内容"
          v-model="textarea2"
        >
        </el-input>

        <el-button type="danger" size="small" @click="imageSubmit"
          >回复</el-button
        >
      </div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      url: this.$route.params.photo,
      fits: [""],
      textarea1: this.$route.params.content,
      textarea2: "",
      id: this.$route.params.id,
    };
  },
  methods: {
    goBack() {
      this.$router.push({
        path: "/police/business_handling/transfer_audit",
        name: "投诉消息",
        params: {},
      });
    },
    //回复
    imageSubmit() {
      axios
        .get("http://localhost:3031/responseMessage", {
          params: {
            id: this.id,
            token: this.textarea2,
          },
        })
        .then((resp) => {
          if (resp.data.code == 200) {
            this.open1();
          }else{
            this.open2();
          }
        });
    },
    open1() {
      const h = this.$createElement;

      this.$notify({
        title: "提示",
        message: h(
          "i",
          { style: "color: teal" },
          "回复成功"
        ),
      });
    },
    open2() {
      const h = this.$createElement;

      this.$notify({
        title: "提示",
        message: h(
          "i",
          { style: "color: teal" },
          "回复失败"
        ),
      });
    },
  },
  mounted() {},
  computed: {},
};
</script>
<style scoped>
.a {
  width: 300px;
}
.b {
  width: 300px;
}
</style>
